<template>
  <div class="badgeWhite baseContent" :style="dataRend.style" v-loading="active">
    <basetitle>
      <slot slot="left">{{dataRend.name}}</slot>
      <slot slot="right">
        <div class="rightFontCont">
          <i class="iconfont icon-shuaxin1 rightFont" @click="refreshFull(dataRend.prn)"></i>
        </div>
      </slot>
    </basetitle>
    <div class="baseCont">
      <div class="chart-container overAuto" v-if="dataRend.itemData"  :style="{ height: dataRend.itemData.height ? dataRend.itemData.height : defalutHeight }">
        <div class="magtop10">
          <el-row>
            <el-col style="padding: 14px;" :span="8" v-for="(item, index) in dataRend.itemData.list" :key="index">
              <div class="scratchable-Latex" style="text-align: center">
                <el-tooltip style="cursor: pointer" class="item" effect="dark" :content="item.res_na" placement="bottom">
                  <div @click="openNewUrl(item)">
                    <img width="64" height="64" :src="item.res_icon_no ? `${pictureshow}${item.res_icon_no}` : '../../../../static/image/e4.png'"/>
                    <p class="ellipsis" style="color: #595959;font-size: 14px;">{{item.res_na}}</p>
                  </div>
                </el-tooltip>
              </div>
            </el-col>
          </el-row>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
  const basetitle =()=>import('@/components/basetitle/index.vue')//
  import {refreshContent,Pictureshows} from "../../../api/config.js"
  import store from '../../../store'
  import { mapState, mapActions } from 'vuex'
  import { getFromCache } from '@/utils/cache.js';
  export default {
    name: 'BigScreamShow',
    props: {
      defalutHeight: {
        type: String,
        default: '300px'
      },
      itemdata: {
        default: Object
      }
    },
    components: {
      basetitle,
    },
    data() {
      return {
        dataRend:{},
        active:false,
        pictureshow:Pictureshows
      };
    },
    computed: {
      ...mapState({
        mainRend:state => store.state.base.mainRend
      }),
    },
    beforeDestroy() {

    },
    mounted() {
      this.dataRend=this.itemdata
    },
    methods: {
      ...mapActions('base', ['getIndexRend']),
      refreshFull(type){
        let that=this;
        that.active=true;
        let parms={};
        parms.type=type;
        parms.user_prn = JSON.parse(getFromCache('userInfo')).env$user_prn;
        that.$post(refreshContent, parms).then(response => {
          setTimeout(function () {
            that.active=false;
          },2000);
          that.dataRend=response.obj
        })
      },
      openNewUrl(v){
        window.open(v.url)
      }
    },
    watch:{

    }
  };
</script>

<style>

</style>
